From 5ea39e7063999e13d767dcad08aedda3ccafb4e8 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Thu, 8 Dec 2005 14:30:15 +0000 Subject: [PATCH] Move xm destroy handling out of crufty destroy.py and into main.py, where it can share the better argument parsing. Closes bug #443. Signed-off-by: Ewan Mellor --- tools/python/xen/xm/destroy.py | 41 ---------------------------------- tools/python/xen/xm/main.py | 9 +++++++- 2 files changed, 8 insertions(+), 42 deletions(-) delete mode 100644 tools/python/xen/xm/destroy.py diff --git a/tools/python/xen/xm/destroy.py b/tools/python/xen/xm/destroy.py deleted file mode 100644 index 345b04a1d7..0000000000 --- a/tools/python/xen/xm/destroy.py +++ /dev/null @@ -1,41 +0,0 @@ -#============================================================================ -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#============================================================================ -# Copyright (C) 2004, 2005 Mike Wray -#============================================================================ - -"""Destroy a domain. -""" - -from xen.xend.XendClient import server -from xen.xm.opts import * - -gopts = Opts(use="""[DOM] - -Destroy a domain. -""") - -gopts.opt('help', short='h', - fn=set_true, default=0, - use="Print this help.") - -def main(argv): - opts = gopts - args = opts.parse(argv) - if opts.vals.help: - opts.usage() - return - if len(args) < 1: opts.err('Missing domain') - dom = args[0] - server.xend_domain_destroy(dom) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 4b173e88c4..ad69090464 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -577,6 +577,13 @@ def xm_vcpu_set(args): from xen.xend.XendClient import server server.xend_domain_set_vcpus(args[0], int(args[1])) + +def xm_destroy(args): + arg_check(args, "destroy", 1) + from xen.xend.XendClient import server + server.xend_domain_destroy(args[0]) + + def xm_domid(args): arg_check(args, "domid", 1) @@ -783,6 +790,7 @@ commands = { # xenstat commands "top": xm_top, # domain commands + "destroy": xm_destroy, "domid": xm_domid, "domname": xm_domname, "rename": xm_rename, @@ -825,7 +833,6 @@ commands = { ## The commands supported by a separate argument parser in xend.xm. subcommands = [ 'create', - 'destroy', 'migrate', 'sysrq', 'shutdown' -- 2.30.2